import React from 'react';
import { AutoComplete as AntdAutoComplete } from 'antd';
import type { AutoCompleteProps as AntdAutoCompleteProps } from 'antd';
import { createStyles } from 'antd-style';

export interface AutoCompleteProps extends AntdAutoCompleteProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  autoComplete: css`
    width: 100%;
  `,
}));

const AutoCompleteComponent: React.FC<AutoCompleteProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const autoCompleteClassName = cx(
    className,
    customClassName,
    styles.autoComplete
  );

  return <AntdAutoComplete className={autoCompleteClassName} {...restProps} />;
};

const AutoComplete = Object.assign(AutoCompleteComponent, {
  _InternalPanelDoNotUseOrYouWillBeFired: (AntdAutoComplete as any)._InternalPanelDoNotUseOrYouWillBeFired,
});

export { AutoComplete };
export default AutoComplete;

